import { get, post } from '@/utils/axios'

const prefixUrl = '/sys/dict/'

/** 字典获取 */
export const getDict = async (type) => {
  return get(`${prefixUrl}dictByType`, { type })
}

/** 保存字典 */
export const saveDict = (form) => {
  return post(`${prefixUrl}saveDict`, form)
}

/** 删除字典 */
export const deleteDict = (id) => {
  return post(`${prefixUrl}delete`, { id })
}

/** 根据类型数组获取字典数组集合 */
export const getDictByKeys = (keys) => {
  return get(`${prefixUrl}getDictByKeys`, { keys })
}

/** 查询当前字典是否存在子节点 */
export const checkChildren = (formId) => {
  return get(`${prefixUrl}checkChildren`, { formId })
}
